package csc309.datingapp;

import java.util.Map;
import java.sql.*;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

/*
 * The Login action takes a username and password from the request
 * and authenticates those tokens agains the portfolioService objects
 * authentication methods.  If the user is valid, the user object
 * is stored in the session map. 
 * 
 * To receive the session map, this action implements the sessionAware
 * interface.  This decouples the action from the servlet API.  Of course,
 * the action could use the ActionContext to get this map, or even the 
 * underlying Servlet Session object, but these would be needless bindings 
 * to the Servlet API, certainly complicating testing. 
 */

public class Logout extends ActionSupport implements SessionAware {
	public String errormsg;

	public String getErrormsg() {
		return errormsg;
	}

	public void setErrormsg(String error) {
		this.errormsg = error;
	}

	public String execute() {
		session.clear();
		return "success";
	}

	/* JavaBeans Properties to Receive Request Parameters */

	private Map<String, String> session;

	public void setSession(Map session) {
		this.session = session;

	}

}
